package com.example.ioc.component;

import com.example.ioc.model.UserInfo;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Primary;
import org.springframework.stereotype.Component;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Li_yizYa
 * Date: 2025/7/8
 * Time: 11:38
 */
@Component
public class UserInfoComponent {
    @Bean
    public UserInfo userInfo() {
        return new UserInfo("zhangsan", 18);
    }

//    @Primary
    @Bean
    public UserInfo userInfo1() {
        return new UserInfo("lisi", 19);
    }

    @Bean
    public String name() {
        return "test";
    }

//    @Primary
    @Bean
    public String name2() {
        return "test2";
    }


    @Bean
    public UserInfo userInfo2(@Qualifier("name2") String name3) {
        return new UserInfo(name3, 19);
    }
}
